<!DOCTYPE html>












  


<html class="theme-next pisces use-motion" lang="zh-CN">
<head><meta name="generator" content="Hexo 3.8.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">












<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">






















<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">

<link href="/css/main.css?v=6.6.0" rel="stylesheet" type="text/css">


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=6.6.0">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=6.6.0">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=6.6.0">


  <link rel="mask-icon" href="/images/logo.svg?v=6.6.0" color="#222">









<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Pisces',
    version: '6.6.0',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: false,
    fastclick: false,
    lazyload: false,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>


  




  <meta property="og:type" content="website">
<meta property="og:title" content="Code Garden">
<meta property="og:url" content="https://royswale.gitee.io/index.html">
<meta property="og:site_name" content="Code Garden">
<meta property="og:locale" content="zh-CN">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Code Garden">






  <link rel="canonical" href="https://royswale.gitee.io/">



<script type="text/javascript" id="page.configurations">
  CONFIG.page = {
    sidebar: "",
  };
</script>

  <title>Code Garden</title>
  











  <noscript>
  <style type="text/css">
    .use-motion .motion-element,
    .use-motion .brand,
    .use-motion .menu-item,
    .sidebar-inner,
    .use-motion .post-block,
    .use-motion .pagination,
    .use-motion .comments,
    .use-motion .post-header,
    .use-motion .post-body,
    .use-motion .collection-title { opacity: initial; }

    .use-motion .logo,
    .use-motion .site-title,
    .use-motion .site-subtitle {
      opacity: initial;
      top: initial;
    }

    .use-motion {
      .logo-line-before i { left: initial; }
      .logo-line-after i { right: initial; }
    }
  </style>
</noscript>

</head>

<body itemscope="" itemtype="http://schema.org/WebPage" lang="zh-CN">

  
  
    
  

  <div class="container sidebar-position-left 
  page-home">
    <div class="headband"></div>

    <header id="header" class="header" itemscope="" itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">Code Garden</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
    
  </div>

  <div class="site-nav-toggle">
    <button aria-label="切换导航栏">
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>



<nav class="site-nav">
  
    <ul id="menu" class="menu">
      
        
        
        
          
          <li class="menu-item menu-item-home menu-item-active">

    
    
    
      
    

    

    <a href="/" rel="section"><i class="menu-item-icon fa fa-fw fa-home"></i> <br>首页</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-archives">

    
    
    
      
    

    

    <a href="/archives/" rel="section"><i class="menu-item-icon fa fa-fw fa-archive"></i> <br>归档</a>

  </li>

      
      
    </ul>
  

  

  
</nav>



  



</div>
    </header>

    


    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          
            

          
          <div id="content" class="content">
            
  <section id="posts" class="posts-expand">
    
      

  

  
  
  

  

  <article class="post post-type-normal" itemscope="" itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://royswale.gitee.io/2018/12/07/charles-grab-packet-of-app/">

    <span hidden itemprop="author" itemscope="" itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Roy Swale">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/avatar.gif">
    </span>

    <span hidden itemprop="publisher" itemscope="" itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Code Garden">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
                
                
                <a href="/2018/12/07/charles-grab-packet-of-app/" class="post-title-link" itemprop="https://royswale.gitee.io/index.html">charles grab packet of app</a>
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">

            
            
            

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              

              
                
              

              <time title="创建时间：2018-12-07 20:43:53 / 修改时间：20:46:02" itemprop="dateCreated datePublished" datetime="2018-12-07T20:43:53+08:00">2018-12-07</time>
            

            
              

              
            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        
          
            <h2 id="use-charles-to-grab-packet-of-app"><a href="#use-charles-to-grab-packet-of-app" class="headerlink" title="use charles to grab packet of app"></a>use charles to grab packet of app</h2><h3 id="miniapp"><a href="#miniapp" class="headerlink" title="miniapp"></a>miniapp</h3><p>videos in miniapp is not friendly, small screen and high latency</p>
<p>so I use Charles to get the video uri, then download to baidu yun disk.</p>

          
        
      
    </div>

    

    
    
    

    

    
       
    
    

    

    <footer class="post-footer">
      

      

      

      
      
        <div class="post-eof"></div>
      
    </footer>
  </div>
  
  
  
  </article>


    
      

  

  
  
  

  

  <article class="post post-type-normal" itemscope="" itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://royswale.gitee.io/2018/12/07/hello-world/">

    <span hidden itemprop="author" itemscope="" itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Roy Swale">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/avatar.gif">
    </span>

    <span hidden itemprop="publisher" itemscope="" itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Code Garden">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
                
                
                <a href="/2018/12/07/hello-world/" class="post-title-link" itemprop="https://royswale.gitee.io/index.html">Hello World</a>
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">

            
            
            

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              

              
                
              

              <time title="创建时间：2018-12-07 20:26:46" itemprop="dateCreated datePublished" datetime="2018-12-07T20:26:46+08:00">2018-12-07</time>
            

            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        
          
            <p>Welcome to <a href="https://hexo.io/" target="_blank" rel="noopener">Hexo</a>! This is your very first post. Check <a href="https://hexo.io/docs/" target="_blank" rel="noopener">documentation</a> for more info. If you get any problems when using Hexo, you can find the answer in <a href="https://hexo.io/docs/troubleshooting.html" target="_blank" rel="noopener">troubleshooting</a> or you can ask me on <a href="https://github.com/hexojs/hexo/issues" target="_blank" rel="noopener">GitHub</a>.</p>
<h2 id="Quick-Start"><a href="#Quick-Start" class="headerlink" title="Quick Start"></a>Quick Start</h2><h3 id="Create-a-new-post"><a href="#Create-a-new-post" class="headerlink" title="Create a new post"></a>Create a new post</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo new <span class="string">"My New Post"</span></span><br></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/writing.html" target="_blank" rel="noopener">Writing</a></p>
<h3 id="Run-server"><a href="#Run-server" class="headerlink" title="Run server"></a>Run server</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo server</span><br></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/server.html" target="_blank" rel="noopener">Server</a></p>
<h3 id="Generate-static-files"><a href="#Generate-static-files" class="headerlink" title="Generate static files"></a>Generate static files</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo generate</span><br></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/generating.html" target="_blank" rel="noopener">Generating</a></p>
<h3 id="Deploy-to-remote-sites"><a href="#Deploy-to-remote-sites" class="headerlink" title="Deploy to remote sites"></a>Deploy to remote sites</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo deploy</span><br></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/deployment.html" target="_blank" rel="noopener">Deployment</a></p>

          
        
      
    </div>

    

    
    
    

    

    
       
    
    

    

    <footer class="post-footer">
      

      

      

      
      
        <div class="post-eof"></div>
      
    </footer>
  </div>
  
  
  
  </article>


    
      

  

  
  
  

  

  <article class="post post-type-normal" itemscope="" itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://royswale.gitee.io/2018/12/07/nodejs-windows-build-tools/">

    <span hidden itemprop="author" itemscope="" itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Roy Swale">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/avatar.gif">
    </span>

    <span hidden itemprop="publisher" itemscope="" itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Code Garden">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
                
                
                <a href="/2018/12/07/nodejs-windows-build-tools/" class="post-title-link" itemprop="https://royswale.gitee.io/index.html">nodejs windows build tools</a>
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">

            
            
            

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              

              
                
              

              <time title="创建时间：2018-12-07 14:11:26 / 修改时间：20:26:46" itemprop="dateCreated datePublished" datetime="2018-12-07T14:11:26+08:00">2018-12-07</time>
            

            
              

              
            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        
          
            <p><a href="https://github.com/nodejs/node-gyp" target="_blank" rel="noopener">https://github.com/nodejs/node-gyp</a><br><a href="https://github.com/Microsoft/nodejs-guidelines/blob/master/windows-environment.md#compiling-native-addon-modules" target="_blank" rel="noopener">https://github.com/Microsoft/nodejs-guidelines/blob/master/windows-environment.md#compiling-native-addon-modules</a></p>
<p>open powershell with administrator privilege</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm i -g --production windows-build-tools</span><br></pre></td></tr></table></figure>
<p>got this</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">Status from the installers:</span><br><span class="line">---------- Visual Studio Build Tools ----------</span><br><span class="line">2018-12-07T14:06:07 : Verbose : [InstalledProductsProviderImpl]: Stream was closed</span><br><span class="line">2018-12-07T14:06:07 : Verbose : [InstallerImpl]: Rpc connection was closed.</span><br><span class="line">2018-12-07T14:06:07 : Verbose : [InstallerImpl]: Stream was closed</span><br><span class="line">2018-12-07T14:06:07 : Verbose : [SetupUpdaterImpl]: Rpc connection was closed.</span><br><span class="line">2018-12-07T14:06:07 : Verbose : [SetupUpdaterImpl]: Stream was closed</span><br><span class="line">------------------- Python --------------------</span><br><span class="line">Python 2.7.15 is already installed, not installing again.</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">Could not install Visual Studio Build Tools.</span><br></pre></td></tr></table></figure>
<p><a href="https://www.bountysource.com/issues/65071541-could-not-install-visual-studio-build-tools" target="_blank" rel="noopener">https://www.bountysource.com/issues/65071541-could-not-install-visual-studio-build-tools</a></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install --global --production windows-build-tools@4.0.0</span><br></pre></td></tr></table></figure>
<img src="/2018/12/07/nodejs-windows-build-tools/windows-build-tools@4.0.0.png">
<p>work smoothly</p>

          
        
      
    </div>

    

    
    
    

    

    
       
    
    

    

    <footer class="post-footer">
      

      

      

      
      
        <div class="post-eof"></div>
      
    </footer>
  </div>
  
  
  
  </article>


    
      

  

  
  
  

  

  <article class="post post-type-normal" itemscope="" itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://royswale.gitee.io/2018/12/07/scott-nodejs-weixin-video-tutorial/">

    <span hidden itemprop="author" itemscope="" itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Roy Swale">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/avatar.gif">
    </span>

    <span hidden itemprop="publisher" itemscope="" itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Code Garden">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
                
                
                <a href="/2018/12/07/scott-nodejs-weixin-video-tutorial/" class="post-title-link" itemprop="https://royswale.gitee.io/index.html">scott nodejs weixin video tutorial</a>
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">

            
            
            

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              

              
                
              

              <time title="创建时间：2018-12-07 13:39:13 / 修改时间：20:26:46" itemprop="dateCreated datePublished" datetime="2018-12-07T13:39:13+08:00">2018-12-07</time>
            

            
              

              
            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        
          
            <h2 id="scott-nodejs-weixin-tutorial"><a href="#scott-nodejs-weixin-tutorial" class="headerlink" title="scott nodejs weixin tutorial"></a>scott nodejs weixin tutorial</h2><h3 id="setup"><a href="#setup" class="headerlink" title="setup"></a>setup</h3><h4 id="weixin"><a href="#weixin" class="headerlink" title="weixin"></a>weixin</h4><p>apply weixin service account and miniapp account</p>
<h4 id="1-6-安装-Node-js-v8-0-生产环境"><a href="#1-6-安装-Node-js-v8-0-生产环境" class="headerlink" title="1-6 安装 Node.js v8.0 生产环境"></a>1-6 安装 Node.js v8.0 生产环境</h4><p>my OS version is Ubuntu 18.04, but he prefer use ubuntu 14.04</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">&gt; sudo apt update</span><br><span class="line"><span class="comment"># &gt; sudo apt upgrade</span></span><br><span class="line"><span class="comment"># &gt; sudo apt autoremove</span></span><br><span class="line">&gt; sudo apt install git vim openssl libssh-dev wget curl build-essential</span><br></pre></td></tr></table></figure>
          
        
      
    </div>

    

    
    
    

    

    
       
    
    

    

    <footer class="post-footer">
      

      

      

      
      
        <div class="post-eof"></div>
      
    </footer>
  </div>
  
  
  
  </article>


    
      

  

  
  
  

  

  <article class="post post-type-normal" itemscope="" itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://royswale.gitee.io/2018/12/06/hexo-image-to-qiniu/">

    <span hidden itemprop="author" itemscope="" itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Roy Swale">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/avatar.gif">
    </span>

    <span hidden itemprop="publisher" itemscope="" itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Code Garden">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
                
                
                <a href="/2018/12/06/hexo-image-to-qiniu/" class="post-title-link" itemprop="https://royswale.gitee.io/index.html">hexo image to qiniu</a>
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">

            
            
            

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              

              
                
              

              <time title="创建时间：2018-12-06 15:44:44" itemprop="dateCreated datePublished" datetime="2018-12-06T15:44:44+08:00">2018-12-06</time>
            

            
              

              
                
                <span class="post-meta-divider">|</span>
                

                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                
                  <span class="post-meta-item-text">更新于</span>
                
                <time title="修改时间：2018-12-07 20:26:46" itemprop="dateModified" datetime="2018-12-07T20:26:46+08:00">2018-12-07</time>
              
            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        
          
            <h2 id="image-process-and-store"><a href="#image-process-and-store" class="headerlink" title="image process and store"></a>image process and store</h2><h3 id="upload-markdown-image-to-qiniu"><a href="#upload-markdown-image-to-qiniu" class="headerlink" title="upload markdown image to qiniu"></a>upload markdown image to qiniu</h3><p><a href="https://yuchen-lea.github.io/2016-01-21-use-qiniu-store-file-for-hexo/" target="_blank" rel="noopener">使用七牛为Hexo存储图片等资源</a><br><a href="https://www.jianshu.com/p/6f77c96b7eff" target="_blank" rel="noopener">Hexo Next主题博客功能完善</a><br><a href="https://marvae.github.io/2017-12-01/qiqiu/" target="_blank" rel="noopener">使用七牛云储存博客图片</a><br><a href="http://farwmarth.com/hexo%E5%9B%BE%E7%89%87%E8%BF%81%E7%A7%BB%E8%87%B3%E4%B8%83%E7%89%9B/" target="_blank" rel="noopener">hexo图片迁移至七牛</a><br><a href="https://github.com/gyk001/hexo-qiniu-sync" target="_blank" rel="noopener">https://github.com/gyk001/hexo-qiniu-sync</a></p>
<h3 id="current-store-image-locally"><a href="#current-store-image-locally" class="headerlink" title="current store image locally"></a>current store image locally</h3><p><a href="https://hexo.io/docs/asset-folders.html" target="_blank" rel="noopener">https://hexo.io/docs/asset-folders.html</a><br><a href="https://lucaseo.github.io/2018/02/20/howtodo-20180220-1/#activate-asset-folder" target="_blank" rel="noopener">https://lucaseo.github.io/2018/02/20/howtodo-20180220-1/#activate-asset-folder</a></p>
<p>modify hexo <code>_config.yml</code></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">post_asset_folder: <span class="literal">true</span></span><br></pre></td></tr></table></figure>
<p>I use VSCode to write post with <a href="https://github.com/mushanshitiancai/vscode-paste-image" target="_blank" rel="noopener">Paste Image</a> extension</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="string">"pasteImage.path"</span>: <span class="string">"<span class="variable">$&#123;currentFileNameWithoutExt&#125;</span>"</span>,</span><br><span class="line"><span class="string">"pasteImage.insertPattern"</span>: <span class="string">"&#123;% asset_img <span class="variable">$&#123;imageFileName&#125;</span> %&#125;"</span>,</span><br></pre></td></tr></table></figure>
<p>configure above in “User Settings” in order to compliant to hexo’s post assets folder convention.</p>

          
        
      
    </div>

    

    
    
    

    

    
       
    
    

    

    <footer class="post-footer">
      

      

      

      
      
        <div class="post-eof"></div>
      
    </footer>
  </div>
  
  
  
  </article>


    
      

  

  
  
  

  

  <article class="post post-type-normal" itemscope="" itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://royswale.gitee.io/2018/12/06/hexo-theme-next/">

    <span hidden itemprop="author" itemscope="" itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Roy Swale">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/avatar.gif">
    </span>

    <span hidden itemprop="publisher" itemscope="" itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Code Garden">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
                
                
                <a href="/2018/12/06/hexo-theme-next/" class="post-title-link" itemprop="https://royswale.gitee.io/index.html">hexo theme next</a>
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">

            
            
            

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              

              
                
              

              <time title="创建时间：2018-12-06 14:48:48" itemprop="dateCreated datePublished" datetime="2018-12-06T14:48:48+08:00">2018-12-06</time>
            

            
              

              
                
                <span class="post-meta-divider">|</span>
                

                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                
                  <span class="post-meta-item-text">更新于</span>
                
                <time title="修改时间：2018-12-07 20:26:46" itemprop="dateModified" datetime="2018-12-07T20:26:46+08:00">2018-12-07</time>
              
            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        
          
            <h2 id="next"><a href="#next" class="headerlink" title="next"></a>next</h2><h3 id="old"><a href="#old" class="headerlink" title="old"></a>old</h3><p><a href="https://theme-next.iissnan.com/getting-started.html" target="_blank" rel="noopener">https://theme-next.iissnan.com/getting-started.html</a></p>
<h3 id="new"><a href="#new" class="headerlink" title="new"></a>new</h3><p><a href="https://github.com/theme-next/hexo-theme-next" target="_blank" rel="noopener">https://github.com/theme-next/hexo-theme-next</a></p>
<p><a href="https://theme-next.org/docs/getting-started/" target="_blank" rel="noopener">https://theme-next.org/docs/getting-started/</a></p>
<h3 id="install"><a href="#install" class="headerlink" title="install"></a>install</h3><p><a href="https://github.com/theme-next/hexo-theme-next#installation" target="_blank" rel="noopener">https://github.com/theme-next/hexo-theme-next#installation</a><br><a href="https://github.com/theme-next/hexo-theme-next/blob/master/docs/INSTALLATION.md" target="_blank" rel="noopener">https://github.com/theme-next/hexo-theme-next/blob/master/docs/INSTALLATION.md</a><br><a href="https://github.com/theme-next/hexo-theme-next/blob/master/docs/INSTALLATION.md#option-3-download-latest-master-branch" target="_blank" rel="noopener">https://github.com/theme-next/hexo-theme-next/blob/master/docs/INSTALLATION.md#option-3-download-latest-master-branch</a></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">$ cd hexo</span><br><span class="line">$ git clone https://github.com/theme-next/hexo-theme-next themes/next</span><br></pre></td></tr></table></figure>
<p>_config.yml</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">## Themes: https://hexo.io/themes/</span><br><span class="line"># theme: landscape</span><br><span class="line">theme: next</span><br></pre></td></tr></table></figure>
<blockquote>
<p>Now you have installed NexT theme, next we will verify whether it is enabled correctly. Between changing the theme and verifying it, we’d better use <code>hexo clean</code> to clean Hexo’s cache.</p>
</blockquote>
<h3 id="update"><a href="#update" class="headerlink" title="update"></a>update</h3><p><a href="https://github.com/theme-next/hexo-theme-next#update" target="_blank" rel="noopener">https://github.com/theme-next/hexo-theme-next#update</a></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">$ cd themes/next</span><br><span class="line">$ git pull</span><br></pre></td></tr></table></figure>
<h3 id="config"><a href="#config" class="headerlink" title="config"></a>config</h3><p>hexo/_config.yml</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">title: Code Garden</span><br><span class="line">author: Roy Swale</span><br><span class="line">language: zh-CN</span><br><span class="line"></span><br><span class="line">url: https://royswale.gitee.io</span><br></pre></td></tr></table></figure>
<p>themes/next/_config.yml</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"># Schemes</span><br><span class="line"># scheme: Muse</span><br><span class="line"># scheme: Mist</span><br><span class="line">scheme: Pisces</span><br><span class="line"># scheme: Gemini</span><br></pre></td></tr></table></figure>
<p>more config…</p>
<p>Configuring Menu Items<br><a href="https://theme-next.org/docs/getting-started/#Configuring-Menu-Items" target="_blank" rel="noopener">https://theme-next.org/docs/getting-started/#Configuring-Menu-Items</a></p>
<p>Custom Page Support<br><a href="https://theme-next.org/docs/theme-settings/#Custom-Page-Support" target="_blank" rel="noopener">https://theme-next.org/docs/theme-settings/#Custom-Page-Support</a></p>

          
        
      
    </div>

    

    
    
    

    

    
       
    
    

    

    <footer class="post-footer">
      

      

      

      
      
        <div class="post-eof"></div>
      
    </footer>
  </div>
  
  
  
  </article>


    
      

  

  
  
  

  

  <article class="post post-type-normal" itemscope="" itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://royswale.gitee.io/2018/12/06/deploy-hexo-to-gitee-pages/">

    <span hidden itemprop="author" itemscope="" itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Roy Swale">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/avatar.gif">
    </span>

    <span hidden itemprop="publisher" itemscope="" itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Code Garden">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
                
                
                <a href="/2018/12/06/deploy-hexo-to-gitee-pages/" class="post-title-link" itemprop="https://royswale.gitee.io/index.html">deploy hexo to gitee pages</a>
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">

            
            
            

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              

              
                
              

              <time title="创建时间：2018-12-06 13:42:02" itemprop="dateCreated datePublished" datetime="2018-12-06T13:42:02+08:00">2018-12-06</time>
            

            
              

              
                
                <span class="post-meta-divider">|</span>
                

                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                
                  <span class="post-meta-item-text">更新于</span>
                
                <time title="修改时间：2018-12-07 20:26:46" itemprop="dateModified" datetime="2018-12-07T20:26:46+08:00">2018-12-07</time>
              
            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        
          
            <h2 id="deply-hexo-to-gitee-pages"><a href="#deply-hexo-to-gitee-pages" class="headerlink" title="deply hexo to gitee pages"></a>deply hexo to gitee pages</h2><h3 id="quick-start"><a href="#quick-start" class="headerlink" title="quick start"></a>quick start</h3><p><a href="https://github.com/hexojs/hexo#installation" target="_blank" rel="noopener">https://github.com/hexojs/hexo#installation</a><br><a href="https://github.com/hexojs/hexo#quick-start" target="_blank" rel="noopener">https://github.com/hexojs/hexo#quick-start</a></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">npm i -g hexo-cli</span><br><span class="line">hexo init blog</span><br><span class="line">cd blog</span><br><span class="line">hexo server</span><br><span class="line">hexo new &quot;a new blog&quot;</span><br><span class="line">hexo generate</span><br></pre></td></tr></table></figure>
<p>create a <strong>private</strong> repo to hold your hexo raw data and configurations.<br><code>https://gitee.com/yourname/whatever.git</code></p>
<h3 id="码云Pages"><a href="#码云Pages" class="headerlink" title="码云Pages"></a>码云Pages</h3><p><a href="https://gitee.com/help/articles/4136#article-header1" target="_blank" rel="noopener">码云Pages 常见问题</a></p>
<blockquote>
<p>如何创建一个首页访问地址不带二级目录的 pages，如ipvb.gitee.io？<br>你需要建立一个与自己个性地址同名的项目</p>
</blockquote>
<p>create a <strong>public</strong> repo <code>https://gitee.com/yourname/yourname.git</code></p>
<p><a href="https://gitee.com/help/articles/4136#article-header2" target="_blank" rel="noopener">码云Pages 一个小白的Pages搭建之旅</a></p>
<h3 id="depoly"><a href="#depoly" class="headerlink" title="depoly"></a>depoly</h3><p><a href="https://hexo.io/zh-cn/docs/deployment.html#Git" target="_blank" rel="noopener">部署 Git</a></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install hexo-deployer-git --save</span><br></pre></td></tr></table></figure>
<p>_config.yml</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"># Deployment</span><br><span class="line">## Docs: https://hexo.io/docs/deployment.html</span><br><span class="line">deploy:</span><br><span class="line">  type: git</span><br><span class="line">  repo: https://gitee.com/yourname/yourname.git</span><br></pre></td></tr></table></figure>
<p>when ready to deploy</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">hexo generate</span><br><span class="line">hexo deploy</span><br></pre></td></tr></table></figure>
<p>go to <code>https://yourname.gitee.io/</code></p>

          
        
      
    </div>

    

    
    
    

    

    
       
    
    

    

    <footer class="post-footer">
      

      

      

      
      
        <div class="post-eof"></div>
      
    </footer>
  </div>
  
  
  
  </article>


    
      

  

  
  
  

  

  <article class="post post-type-normal" itemscope="" itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://royswale.gitee.io/2018/12/06/How-to-install-LEMP-on-Ubuntu-18-04/">

    <span hidden itemprop="author" itemscope="" itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Roy Swale">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/avatar.gif">
    </span>

    <span hidden itemprop="publisher" itemscope="" itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Code Garden">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
                
                
                <a href="/2018/12/06/How-to-install-LEMP-on-Ubuntu-18-04/" class="post-title-link" itemprop="https://royswale.gitee.io/index.html">How to install LEMP on Ubuntu 18.04</a>
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">

            
            
            

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              

              
                
              

              <time title="创建时间：2018-12-06 11:44:23" itemprop="dateCreated datePublished" datetime="2018-12-06T11:44:23+08:00">2018-12-06</time>
            

            
              

              
                
                <span class="post-meta-divider">|</span>
                

                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                
                  <span class="post-meta-item-text">更新于</span>
                
                <time title="修改时间：2018-12-07 20:26:46" itemprop="dateModified" datetime="2018-12-07T20:26:46+08:00">2018-12-07</time>
              
            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        
          
            <h2 id="How-to-install-LEMP-on-Ubuntu-18-04"><a href="#How-to-install-LEMP-on-Ubuntu-18-04" class="headerlink" title="How to install LEMP on Ubuntu 18.04"></a>How to install LEMP on Ubuntu 18.04</h2><p>How To Install Linux, Nginx, MySQL, PHP (LEMP stack) on Ubuntu 18.04<br><a href="https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-ubuntu-18-04" target="_blank" rel="noopener">https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-ubuntu-18-04</a><br>主要是按照这个文章来的</p>
<h3 id="Initial-setup"><a href="#Initial-setup" class="headerlink" title="Initial setup"></a>Initial setup</h3><p><a href="https://linuxconfig.org/allow-ssh-root-login-on-ubuntu-18-04-bionic-beaver-linux" target="_blank" rel="noopener">https://linuxconfig.org/allow-ssh-root-login-on-ubuntu-18-04-bionic-beaver-linux</a><br>ubuntu 18 默认不允许 root 登陆</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ssh ubuntu@your_server_ip</span><br></pre></td></tr></table></figure>
<p>Initial Server Setup with Ubuntu 18.04<br><a href="https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-18-04" target="_blank" rel="noopener">https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-18-04</a></p>
<h4 id="创建新用户-赋予sudo权限"><a href="#创建新用户-赋予sudo权限" class="headerlink" title="创建新用户 赋予sudo权限"></a>创建新用户 赋予sudo权限</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">&gt; sudo adduser robin</span><br><span class="line">&gt; sudo usermod -aG sudo robin</span><br></pre></td></tr></table></figure>
<h4 id="开启-ufw"><a href="#开启-ufw" class="headerlink" title="开启 ufw"></a>开启 ufw</h4><p>UFW Essentials: Common Firewall Rules and Commands<br><a href="https://www.digitalocean.com/community/tutorials/ufw-essentials-common-firewall-rules-and-commands" target="_blank" rel="noopener">https://www.digitalocean.com/community/tutorials/ufw-essentials-common-firewall-rules-and-commands</a><br><a href="https://linuxize.com/post/how-to-setup-a-firewall-with-ufw-on-ubuntu-18-04/" target="_blank" rel="noopener">https://linuxize.com/post/how-to-setup-a-firewall-with-ufw-on-ubuntu-18-04/</a></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">&gt; sudo ufw app list</span><br><span class="line">Available applications:</span><br><span class="line">  OpenSSH</span><br><span class="line"></span><br><span class="line">&gt; sudo ufw allow OpenSSH</span><br><span class="line">&gt; sudo ufw <span class="built_in">enable</span></span><br><span class="line">&gt; sudo ufw status</span><br><span class="line">Status: active</span><br><span class="line"></span><br><span class="line">To                         Action      From</span><br><span class="line">--                         ------      ----</span><br><span class="line">OpenSSH                    ALLOW       Anywhere</span><br><span class="line">OpenSSH (v6)               ALLOW       Anywhere (v6)</span><br><span class="line">`</span><br></pre></td></tr></table></figure>
<h4 id="ssh-key-没用到"><a href="#ssh-key-没用到" class="headerlink" title="ssh key 没用到"></a>ssh key 没用到</h4><p>How to Set Up SSH Keys on Ubuntu 18.04<br><a href="https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys-on-ubuntu-1804" target="_blank" rel="noopener">https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys-on-ubuntu-1804</a></p>
<h3 id="Nginx"><a href="#Nginx" class="headerlink" title="Nginx"></a>Nginx</h3><p>用上面创建的新用户 登陆，完成后续操作</p>
<h4 id="install-nginx"><a href="#install-nginx" class="headerlink" title="install nginx"></a>install nginx</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">&gt; sudo apt update</span><br><span class="line">&gt; sudo apt install nginx</span><br><span class="line">&gt; sudo service nginx status</span><br></pre></td></tr></table></figure>
<h4 id="enable-http-port-80"><a href="#enable-http-port-80" class="headerlink" title="enable http port 80"></a>enable http port 80</h4><blockquote>
<p>It is recommended that you enable the most restrictive profile that will still allow the traffic you want. Since you haven’t configured SSL for your server in this guide, you will only need to allow traffic on port 80.</p>
</blockquote>
<blockquote>
<p>ssl 和 HTTPS 以后再配置</p>
</blockquote>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br></pre></td><td class="code"><pre><span class="line">&gt; sudo ufw app list</span><br><span class="line">Available applications:</span><br><span class="line">  Nginx Full</span><br><span class="line">  Nginx HTTP</span><br><span class="line">  Nginx HTTPS</span><br><span class="line">  OpenSSH</span><br><span class="line"></span><br><span class="line">&gt; sudo ufw status</span><br><span class="line">Status: active</span><br><span class="line"></span><br><span class="line">To                         Action      From</span><br><span class="line">--                         ------      ----</span><br><span class="line">OpenSSH                    ALLOW       Anywhere</span><br><span class="line">OpenSSH (v6)               ALLOW       Anywhere (v6)</span><br><span class="line"></span><br><span class="line">&gt; sudo ufw allow <span class="string">'Nginx HTTP'</span></span><br><span class="line">Rule added</span><br><span class="line">Rule added (v6)</span><br><span class="line">&gt; sudo ufw status</span><br><span class="line">Status: active</span><br><span class="line"></span><br><span class="line">To                         Action      From</span><br><span class="line">--                         ------      ----</span><br><span class="line">OpenSSH                    ALLOW       Anywhere</span><br><span class="line">Nginx HTTP                 ALLOW       Anywhere</span><br><span class="line">OpenSSH (v6)               ALLOW       Anywhere (v6)</span><br><span class="line">Nginx HTTP (v6)            ALLOW       Anywhere (v6)</span><br></pre></td></tr></table></figure>
<p>这时访问你的服务器 IP，就可以看到nginx的默认欢迎页面了</p>
<h4 id="hide-nginx-version"><a href="#hide-nginx-version" class="headerlink" title="hide nginx version"></a>hide nginx version</h4><p>How to Hide Nginx Server Version in Linux<br><a href="https://www.tecmint.com/hide-nginx-server-version-in-linux/" target="_blank" rel="noopener">https://www.tecmint.com/hide-nginx-server-version-in-linux/</a></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">&gt; sudo vi /etc/nginx/nginx.conf</span><br><span class="line"></span><br><span class="line"><span class="comment"># add or uncomment this line</span></span><br><span class="line">server_tokens off;</span><br></pre></td></tr></table></figure>
<h3 id="MySQL"><a href="#MySQL" class="headerlink" title="MySQL"></a>MySQL</h3><p>Step 2 – Installing MySQL to Manage Site Data<br><a href="https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-ubuntu-18-04" target="_blank" rel="noopener">https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-ubuntu-18-04</a></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">&gt; sudo apt install mysql-server</span><br><span class="line">&gt; sudo mysql_secure_installation</span><br><span class="line">VALIDATE PASSWORD PLUGIN</span><br><span class="line">y</span><br><span class="line">2</span><br><span class="line">left option all answer y</span><br></pre></td></tr></table></figure>
<blockquote>
<p>Note that in Ubuntu systems running MySQL 5.7 (and later versions), the root MySQL user is set to authenticate using the auth_socket plugin by default rather than with a password.</p>
</blockquote>
<p>我没有修改这个默认方式<br>以上安装过程是按照上面的 digitalocean 的文章来的，下面不是</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">&gt; sudo mysql</span><br></pre></td></tr></table></figure>
<p>create a database</p>
<figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">mysql&gt; create database tablename;</span><br></pre></td></tr></table></figure>
<p>create a new user and grant privilege to that database</p>
<p><a href="https://dev.mysql.com/doc/refman/5.7/en/adding-users.html" target="_blank" rel="noopener">https://dev.mysql.com/doc/refman/5.7/en/adding-users.html</a></p>
<figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">mysql&gt; CREATE USER 'finley'@'localhost' IDENTIFIED BY 'password';</span><br><span class="line">mysql&gt; GRANT ALL PRIVILEGES ON tablename.* TO 'finley'@'localhost';</span><br><span class="line">mysql&gt; CREATE USER 'finley'@'%' IDENTIFIED BY 'password';</span><br><span class="line">mysql&gt; GRANT ALL PRIVILEGES ON tablename.* TO 'finley'@'%';</span><br><span class="line">mysql&gt; FLUSH PRIVILEGES;</span><br><span class="line">mysql&gt; show grants for 'finley'@'localhost';</span><br><span class="line">mysql&gt; show grants for 'finley'@'%';</span><br><span class="line">mysql&gt; exit;</span><br></pre></td></tr></table></figure>
<blockquote>
<p>The ‘finley‘@’localhost’ account is necessary if there is an anonymous-user account for localhost. Without the ‘finley‘@’localhost’ account, that anonymous-user account takes precedence when finley connects from the local host and finley is treated as an anonymous user. The reason for this is that the anonymous-user account has a more specific Host column value than the ‘finley‘@’%’ account and thus comes earlier in the user table sort order.</p>
</blockquote>
<p>修改 mysql 配置文件的 bind-address</p>
<p><a href="https://www.techrepublic.com/article/how-to-set-up-mysql-for-remote-access-on-ubuntu-server-16-04/" target="_blank" rel="noopener">https://www.techrepublic.com/article/how-to-set-up-mysql-for-remote-access-on-ubuntu-server-16-04/</a><br><a href="https://www.digitalocean.com/community/questions/how-do-i-open-port-3306-with-ufw" target="_blank" rel="noopener">https://www.digitalocean.com/community/questions/how-do-i-open-port-3306-with-ufw</a></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">&gt; sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf</span><br><span class="line"></span><br><span class="line"><span class="comment"># bind-address = 127.0.0.1</span></span><br><span class="line"><span class="built_in">bind</span>-address = 0.0.0.0</span><br></pre></td></tr></table></figure>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">&gt; sudo service mysql status</span><br><span class="line">&gt; sudo service mysql restart</span><br></pre></td></tr></table></figure>
<p>ufw (Ubuntu FireWall)</p>
<p><a href="https://www.spritle.com/blogs/2015/02/25/how-to-enable-mysql-for-remote-access/" target="_blank" rel="noopener">https://www.spritle.com/blogs/2015/02/25/how-to-enable-mysql-for-remote-access/</a></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">&gt; sudo ufw status verbose</span><br><span class="line"></span><br><span class="line">Status: active</span><br><span class="line">Logging: on (low)</span><br><span class="line">Default: deny (incoming), allow (outgoing), disabled (routed)</span><br><span class="line">New profiles: skip</span><br><span class="line"></span><br><span class="line">To                         Action      From</span><br><span class="line">--                         ------      ----</span><br><span class="line">22/tcp (OpenSSH)           ALLOW IN    Anywhere</span><br><span class="line">80/tcp (Nginx HTTP)        ALLOW IN    Anywhere</span><br><span class="line">22/tcp (OpenSSH (v6))      ALLOW IN    Anywhere (v6)</span><br><span class="line">80/tcp (Nginx HTTP (v6))   ALLOW IN    Anywhere (v6)</span><br></pre></td></tr></table></figure>
<p>test if can access 3306 port</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">&gt; telnet your_server_ip 3306</span><br><span class="line"></span><br><span class="line">Trying your_server_ip...</span><br></pre></td></tr></table></figure>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">&gt; sudo ufw allow 3306</span><br><span class="line"></span><br><span class="line">Rule added</span><br><span class="line">Rule added (v6)</span><br></pre></td></tr></table></figure>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">&gt; sudo ufw status</span><br><span class="line"></span><br><span class="line">Status: active</span><br><span class="line"></span><br><span class="line">To                         Action      From</span><br><span class="line">--                         ------      ----</span><br><span class="line">OpenSSH                    ALLOW       Anywhere</span><br><span class="line">Nginx HTTP                 ALLOW       Anywhere</span><br><span class="line">3306                       ALLOW       Anywhere</span><br><span class="line">OpenSSH (v6)               ALLOW       Anywhere (v6)</span><br><span class="line">Nginx HTTP (v6)            ALLOW       Anywhere (v6)</span><br><span class="line">3306 (v6)                  ALLOW       Anywhere (v6)</span><br></pre></td></tr></table></figure>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">&gt; telnet your_server_ip 3306</span><br><span class="line"></span><br><span class="line">Trying your_server_ip...</span><br><span class="line">Connected to your_server_ip.</span><br></pre></td></tr></table></figure>
<p>这时用 Navicat Premium 也可以连接上这个用户的数据库了</p>
<p>bingo</p>
<h3 id="PHP"><a href="#PHP" class="headerlink" title="PHP"></a>PHP</h3><p>Step 3 – Installing PHP and Configuring Nginx to Use the PHP Processor<br><a href="https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-ubuntu-18-04#step-3-%E2%80%93-installing-php-and-configuring-nginx-to-use-the-php-processor" target="_blank" rel="noopener">https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-ubuntu-18-04#step-3-%E2%80%93-installing-php-and-configuring-nginx-to-use-the-php-processor</a></p>

          
        
      
    </div>

    

    
    
    

    

    
       
    
    

    

    <footer class="post-footer">
      

      

      

      
      
        <div class="post-eof"></div>
      
    </footer>
  </div>
  
  
  
  </article>


    
  </section>

  


          </div>
          

        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      

      <section class="site-overview-wrap sidebar-panel sidebar-panel-active">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope="" itemtype="http://schema.org/Person">
            
              <p class="site-author-name" itemprop="name">Roy Swale</p>
              <p class="site-description motion-element" itemprop="description"></p>
          </div>

          
            <nav class="site-state motion-element">
              
                <div class="site-state-item site-state-posts">
                
                  <a href="/archives/">
                
                    <span class="site-state-item-count">8</span>
                    <span class="site-state-item-name">日志</span>
                  </a>
                </div>
              

              

              
            </nav>
          

          

          

          

          
          

          
            
          
          

        </div>
      </section>

      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2018</span>
  <span class="with-love" id="animate">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Roy Swale</span>

  

  
</div>


  <div class="powered-by">由 <a href="https://hexo.io" class="theme-link" rel="noopener" target="_blank">Hexo</a> 强力驱动 v3.8.0</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 – <a href="https://theme-next.org" class="theme-link" rel="noopener" target="_blank">NexT.Pisces</a> v6.6.0</div>




        








        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    
	
    

    
  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>


























  
  
    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=6.6.0"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=6.6.0"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=6.6.0"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=6.6.0"></script>



  

  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=6.6.0"></script>



  



  










  





  

  

  

  

  

  
  

  

  

  

  

  

  

</body>
</html>
